import request from "@/utils/request";

const URL = "/v3/auth/store";

class StoreeApi {
  static getOptions() {
    return request<any, OptionType>({
      url: `${URL}/options`,
      method: "get",
      headers: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
    });
  }
  /**
   * 根据ID获取店铺信息
   *
   */
  static getStoreID(id: string) {
    return request<any, InformationVO>({
      url: `${URL}/id/${id}`,
      method: "get",
      headers: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
    });
  }
  /**
   * 添加客户以及用户
   */
  static addCustomer(data: RuleForm) {
    return request({
      url: `${URL}/addStore`,
      method: "post",
      data: data,
    });
  }
  /**
   * 获取客户及其联系人信息
   *
   */
  static getselectCustomerAndContact(customerId: string) {
    return request<any, OptionType[]>({
      url: `${URL}/storeId/${customerId}`,
      method: "get",
      headers: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
    });
  }
  static upCustomer(data: RuleForm) {
    return request({
      url: `${URL}/updateStore`,
      method: "put",
      headers: {
        "Content-Type": "application/json",
      },
      data: data,
    });
  }
  /**
   * 删除用户
   */
  static deletecustomer(ids: string) {
    return request({
      url: `${URL}/delete/` + ids,
      method: "DELETE",
      headers: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
    });
  }
}

export default StoreeApi;

/**
 * 日志分页查询对象
 */
export interface LogPageQuery {
  /** 搜索关键字 */
  keywords?: string;
  pages?: any;
  module?: string;
  operation?: string;
  content?: string;
  type?: string;
  ip?: string;
  customerId?: number;
}

/**
 * 系统日志分页VO
 */
export interface LogPageVO {
  current: number;
  pages: number;
  records: Array<any>;
  size: number;
  total: number;
}
export interface InformationVO {
  id: string;
  creatorId: string;
  createTime: string;
  customerId: string;
  parentId: string;
  storeName: string;
  address: string;
  contact: string;
  contactNumber: string;
  lng: number;
  lat: number;
  enableFlag: string;
  updateTime: string;
}
export interface RuleForm {
  userId?: string;
  username: string;
  password?: string | number;
  idCardNo: string;
  userEnableFlag: string;
  roleIdList?: string[];
  other: string;
  storeId?: string;
  parentId?: string;
  storeName: string;
  address: string;
  lng?: number | string;
  lat?: number | string;
  storeEnableFlag: string;
  name: string;
  phone: string;
  customerId?: string;
}
